/*
 * @Author: 朱洪伟 hongwei.zhu@evg.co
 * @Date: 2025-07-09 16:45:14
 * @朱洪伟: 朱洪伟 hongwei.zhu@evg.co
 * @LastEditTime: 2025-07-11 18:25:53
 * @FilePath: /AutocostApp/src/types/Route.ts
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import * as Pages from '@/pages';

export type TPages = typeof Pages;
export type TRouteName =
  | keyof TPages
  | 'ResetPwd'
  | 'Register'
  | 'Main'
  | 'Login';

// 创建一个包含所有页面组件的类型
export type TPageComponents = TPages & {
  ResetPwd: any;
  Register: any;
  Main: any;
  Login: any;
};

type TLazyComponent<T> = () => Promise<(props: T) => any>;

export type TRouteParam<T extends TRouteName> = T extends keyof TPages
  ? TPages[T] extends TLazyComponent<infer F>
    ? F extends {}
      ? F
      : {} | undefined
    : {} | undefined
  : {} | undefined;

export type TRootRouteParam<T extends TRouteName = TRouteName> = Record<
  T,
  TRouteParam<T>
>;
